// 用户相关路由
var express = require('express');
var ProductRouter = express.Router();
const ProductController = require('../../controllers/admin/ProductController')
// 图片上传
const multer = require('multer')
const upload = multer({ dest: 'public/productuploads/' })

/* POST login page. */
// 添加产品
ProductRouter.post('/adminapi/product/add', upload.single('file'), ProductController.add);
ProductRouter.get('/adminapi/product/list',ProductController.getAll)
// 查询产品列表信息
ProductRouter.get("/adminapi/product/list/publisher/:publisher", ProductController.getListByPublisher)
// 删除产品
ProductRouter.delete("/adminapi/product/list/:id", ProductController.deleteProduct)
// 根据产品id查询产品信息 /adminapi/product/list/id/${route.params.id}
ProductRouter.get("/adminapi/product/list/id/:id", ProductController.getProductById)
// 更新产品信息 /adminapi/product/update
ProductRouter.post("/adminapi/product/update", upload.single('file'), ProductController.update)





module.exports = ProductRouter;